import { defineStore } from "pinia";

import type { CounterStore } from "./counter.d";

const useCounterStore = defineStore("counter", {
  state: (): CounterStore => {
    return {
      count: 0,
      persons: [],
    };
  },
  getters: {
    oddOrEven(state) {
      return state.count % 2 === 0 ? "偶数" : "奇数";
    },
  },
  actions: {
    increment(a: number, b: number, c: number, d: number) {
      console.log(a, b, c, d);
      this.count++;
    },
    decrement() {
      this.count--;
    },
  },
});

export default useCounterStore;
